package benlai_miniprogram;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import ocg.common.re.read.JsonAssign;

import java.util.Map;

/**
 * Created by chenbo on 2018/5/10.
 */
public class HttpConf {

    static {
        JsonAssign.getJosnAssign ( HttpConf.class );
    }

    /**
     * 协议（http/https）
     */
    private static String Scheme;

    /**
     * host
     */
    private static String Host;

    /**
     * ip
     */
    private static String Ip;

    /**
     * 端口 part
     */
    private static int Part;

    /**
     * 编码格式 Charset
     */
    private static String Charset;

    /**
     * 请求头 header
     */
    private static JSONObject Headers;

    /**
     * cookies
     */
    private static JSONObject Cookies;

    public static String getScheme() {
        return HttpConf.Scheme;
    }

    public static String getHost() {
        return HttpConf.Host;
    }

    public static String getIp() {
        return HttpConf.Ip;
    }

    public static int getPart() {
        return HttpConf.Part;
    }

    public static String getCharset() {
        return HttpConf.Charset;
    }

    public static Map<String,String> getHeaders() {
        return JSONObject.parseObject ( HttpConf.Headers.toJSONString () , new TypeReference<Map <String, String>> (){} );
    }

    public static Map<String,String> getCookies() {
        return JSONObject.parseObject ( HttpConf.Cookies.toJSONString () , new TypeReference<Map<String,String>> (){} );
    }
}
